package a05_双指针法;

/**
 * <p>
 * a05_反转链表复习4
 * </p>
 *
 * @author flyduck
 * @since 2025/2/19
 */
public class a05_反转链表复习4 {
    public ListNode reverseList(ListNode head) {
        ListNode prev = null;
        ListNode cur = head;

        while (cur != null){
            ListNode next = cur.next;

            cur.next = prev;

            prev = cur;
            cur = next;
        }

        return prev;
    }
}
